package com.oocl.im.util;

import java.sql.Connection;
import java.sql.SQLException;

import org.apache.commons.dbcp.BasicDataSource;

public class DatabaseUtil {
	private static final String className = "oracle.jdbc.OracleDriver";
	private static final String url = "jdbc:oracle:thin:@127.0.0.1:1521:xe";
	private static final String username = "wyatt";
	private static final String psd = "123456";
	private static BasicDataSource dataSource = new BasicDataSource();
	static {
		dataSource.setUrl(url);
		dataSource.setDriverClassName(className);
		dataSource.setUsername(username);
		dataSource.setPassword(psd);
		dataSource.setMaxActive(4);
	}

	public static Connection getConnection() {
		Connection con = null;
		try {
			con = dataSource.getConnection();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return con;
	}

}
